<?php

namespace app\index\controller;

use think\exception\ValidateException;
use app\model\MemberAccountType;
use app\model\MemberAccount;

class MemberaccountController extends Base
{

    public function list()
    {
        $weid = weid();
        $data = MemberAccountType::where(['status' => 1, 'weid' => $weid])
            ->order('sort asc,id asc')
            ->select()
            ->toArray();
        $mid = UID();
        foreach ($data as &$vo) {
            $vo['points'] = MemberAccount::getpoints($mid, $vo['id']);
        }

        return $this->json(['data' => $data]);
    }
}
